#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import cv2
# grayImage = cv2.imread('1.png', cv2.IMREAD_GRAYSCALE)
# # 可选参数CV_LOAD_IMAGE_COLOR (BGR), CV_LOAD_IMAGE_GRAYSCALE (grayscale), CV_LOAD_IMAGE_UNCHANGED(neither)
# cv2.imwrite('temp_search.png', grayImage)


img_rgb = cv2.imread('/home/liusen/IdeaWorkspace/wechat-jump/images/00000_1514969672.png')
img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)
temp_end = cv2.imread('temp_end.jpg', 0)

cv2.imwrite('temp1.jpg', img_gray)
cv2.imwrite('temp2.jpg', temp_end)

res_end1 = cv2.matchTemplate(img_gray,
                             temp_end,
                             cv2.TM_CCOEFF_NORMED
                             )

res1_match_ratio = cv2.minMaxLoc(res_end1)[1]

print('res1_match_ratio={}'.format(res1_match_ratio))
